package cn.wolfcode.crm.query;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.LinkedHashMap;
import java.util.Map;

/**
 * Created by Administrator on 2018/6/12.
 */

@Getter
@Setter
public class EmpChartQueryObject extends QueryObject{

    private Long organizationId = -1L;
    private Long productId = -1L;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date beginTime;

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date endTime;

    private String groupType = "e.username";

    public void setGroupType(String groupType){
        if ("yy".equals(groupType)){
            this.groupType="DATE_FORMAT(c.startDate , '%Y-%m')";
        }else if ("dd".equals(groupType)){
            this.groupType="DATE_FORMAT(c.startDate , '%Y-%m-%d')";
        }else {
            this.groupType=groupType;
        }
    }
}
